package Modele;

import Controleur.JDOM;
import Controleur.JDOM2;
import Vue.Fenetre;
import Vue.TAT;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.Scanner;

public abstract class Question {

    private Map<String, Boolean> reponses;
    private Map<String, Integer> tatrep;
    private String type;
    private String enonce; 
    private String enonce2;
    private Questionnaire q;
    private JDOM jdom;
    private Fenetre frame;
    private TAT tat;
    private int nbquest; 

    public Question(String f, String type, Questionnaire qs) {
       q = qs;
        nbquest = q.getNbquestion();
   //     System.out.println("NB QUEST AVANT JDOM : " +nbquest);
        this.type = type;
        if (type.equals("TAT")) {
            if(q.getIndice() <= 9)
            
            jdom = new JDOM(f, nbquest);
            
//            System.out.println("************  NB QUESTION : " + jtdom.getNbquestion());
//            System.out.println("enonce : " + enonce);
//            System.out.println("reponse " + tatrep);
//            System.out.println("enonce " + enonce2);
//            
//            System.out.println("taille de la liste tat : " +q.getTlist().size());
        }
             if (type.equals("QCM")) {
            JDOM2 jdom = new JDOM2(f);
            this.enonce = jdom.getEnonce();
            reponses = jdom.getReponses();
        }
        }
       
    
    

        public boolean addReponse(String reponse, boolean type){
            System.out.println("reponse : " +reponse);
            System.out.println("type : " +type);
            reponses.put(reponse, type);
           return true;
        }
        
	/**
	 * retourne l'enonce de la question.
	 */
	public String getEnonce() {
		return this.enonce;
	}

	/**
	 * retourne la (ou l'ensemble de) reponse a la question.
	 */
	public Map<String, Boolean> getReponses() {
		return this.reponses;
	}
        
        public abstract String toString();

    public void setReponses(Map<String, Boolean> reponses) {
        this.reponses = reponses;
    }

    public JDOM getJdom() {
        return jdom;
    }
        
        
        

}